﻿using System;

namespace ConsoleApp3_Bank
{
    public class ATM
    {
        private Account CurrentAccount;//当前账号

        //设置当前账号
        public void SetAccount(Account account)
        {
            CurrentAccount = account;
        }

        //存款
        public void Deposit(decimal amount)
        {
            if (CurrentAccount != null)
            {
                CurrentAccount.Deposit(amount);
            }
            else
            {
                Console.WriteLine("无账户信息。");
            }
        }

        //取款
        public void Withdraw(decimal amount)
        {
            if (CurrentAccount != null)
            {
                CurrentAccount.Withdraw(amount);
            }
            else
            {
                Console.WriteLine("无账户信息。");
            }
        }

        //查询余额
        public void CheckBalance()
        {
            if (CurrentAccount != null)
            {
                CurrentAccount.DisplayBalance();
            }
            else
            {
                Console.WriteLine("无账户信息。");
            }
        }
    }
}
